﻿@model Guan.CMS.Web.ViewModels.Article.ArticleFormModel
@{
    ViewBag.Title = "编辑博客日志";
    ViewBag.SectionTitleImage = "ico-content.png";
}
@section Styles{
    <link rel="stylesheet" type="text/css" href="@Url.Content("~/Content/select2.css")"/>
}
@using (Html.BeginForm("Edit","Article"))
{
    <div class="section-header">
        <div class="title">
            @if (ViewBag.SectionTitleImage != null)
            {
                <img src="@Url.Content("~/Content/Images/Admin/" + ViewBag.SectionTitleImage)" alt="" />
            }
            @ViewBag.Title
        </div>
        <div class="options">
            <input type="submit" value="保存" class="k-button"/>
            <a href="@Url.Action("List")" class="k-button">返回列表</a>
        </div>
    </div>
    <div class="section-body">
        @Html.ValidationSummary()
        @(Html.Kendo().TabStrip().Name("ArticleEditTab")
              .Items(tabstrip =>
              {
                  tabstrip.Add().Text("基本信息").Selected(true).Content(TabBaseinfo().ToHtmlString());
                  tabstrip.Add().Text("搜索引擎优化").Content(TabSeoInfo().ToHtmlString());
                  //tabstrip.Add().Text("社交网络分享").Content(TabSnsInfo().ToHtmlString());
              }
              ).Animation(false)
              )
    </div>
}


@helper TabBaseinfo(){
    @Html.HiddenFor(model => model.Id)
    <table class="main">
        <tr>
            <th>@Html.LabelFor(model => model.Title)
            </th>
            <td>
                @Html.TextBoxFor(model => model.Title, new { style = "width:100%;", @class = "k-textbox" })
                @Html.ValidationMessageFor(model => model.Title)
            </td>
        </tr>
        <tr>
            <th>@Html.LabelFor(model => model.Body)
            </th>
            <td>
                @(Html.Kendo().Editor().Name("body")
                      .Tools(tools => tools
                                          .SubScript()
                                          .SuperScript()
                                          .ViewHtml()
                      )
                      .HtmlAttributes(new{style="height:400px;"})
                      .ImageBrowser(imageBrower => imageBrower
                                                       .Image("~/Uploadfiles/Images/{0}")
                                                       .Read("Read", "ImageBrowser")
                                                       .Create("Create", "ImageBrowser")
                                                       .Destroy("Destroy", "ImageBrowser")
                                                       .Upload("Upload", "ImageBrowser")
                                                       .Thumbnail("Thumbnail", "ImageBrowser")))
            </td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.CategoryId)</th>
            <td>@Html.DropDownList("CategoryId", ViewBag.ArticleCategory as List<SelectListItem>,new{style="width:300px;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(model => model.Tags)
            </th>
            <td>
                @Html.TextBoxFor(model => model.Tags, new { @class = "k-textbox",style="width:400px;" })
                @Html.ValidationMessageFor(model => model.Tags)
            </td>
        </tr>
        <tr>
            <th>@Html.LabelFor(model => model.StartTime)
            </th>
            <td>
                @Html.EditorFor(model => model.StartTime)
                @Html.ValidationMessageFor(model => model.StartTime)
            </td>
        </tr>
        <tr>
            <th>@Html.LabelFor(model => model.EndTime)
            </th>
            <td>
                @Html.EditorFor(model => model.EndTime)
                @Html.ValidationMessageFor(model => model.EndTime)
            </td>
        </tr>
        <tr>
            <th>@Html.LabelFor(model => model.IsPublished)
            </th>
            <td>
                @Html.EditorFor(model => model.IsPublished)
                @Html.ValidationMessageFor(model => model.IsPublished)
            </td>
        </tr>
        <tr>
            <th>
            </th>
            <td>
            </td>
        </tr>
    </table>
}

@helper TabSeoInfo(){
    <table class="main">
        <tr>
            <th>@Html.LabelFor(m => m.MetaKeywords)</th>
            <td>@Html.TextBoxFor(m => m.MetaKeywords,new{@class="k-textbox",style="width:100%;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.MetaDescription)</th>
            <td>@Html.TextAreaFor(m => m.MetaDescription,new{@class="k-textbox",style="width:100%;height:4em;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.MetaTitle)</th>
            <td>@Html.TextBoxFor(m => m.MetaTitle,new{@class="k-textbox",style="width:100%;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.FriendlyName)</th>
            <td>@Html.TextBoxFor(m => m.FriendlyName,new{@class="k-textbox",style="width:100%;"})</td>
        </tr>
    </table>
}
@*@helper TabSnsInfo(){
    @Html.HiddenFor(m => m.SNS.Id)
    <table class="main">
        <tr>
            <th>@Html.LabelFor(m => m.SNS.Description)</th>
            <td>@Html.TextAreaFor(m => m.SNS.Description,new{@class="k-textbox",style="height:4em;width:100%;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.SNS.Text)</th>
            <td>@Html.TextAreaFor(m => m.SNS.Text,new{@class="k-textbox",style="height:4em;width:100%;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.SNS.PopTitle)</th>
            <td>@Html.TextBoxFor(m => m.SNS.PopTitle,new{@class="k-textbox",style="width:100%;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.SNS.TopHeight)</th>
            <td>@Html.TextBoxFor(m => m.SNS.TopHeight,new{@class="k-textbox",style="width:60px;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.SNS.Comment)</th>
            <td>@Html.TextAreaFor(m => m.SNS.Comment,new{@class="k-textbox",style="height:4em;width:100%;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.SNS.PictureUrl)</th>
            <td>@Html.TextBoxFor(m => m.SNS.PictureUrl,new{@class="k-textbox",style="width:100%;"})</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.SNS.CatchedPic)</th>
            <td>@Html.EditorFor(m => m.SNS.CatchedPic)</td>
        </tr>
        <tr>
            <th>@Html.LabelFor(m => m.SNS.WeiboUid)</th>
            <td>@Html.TextBoxFor(m => m.SNS.WeiboUid,new{@class="k-textbox",style="width:100%;"})</td>
        </tr>
    </table>
}*@

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    <script type="text/javascript" src="@Url.Content("~/Scripts/select2.min.js")"></script>
    <script type="text/javascript">
        $(function () {
            $("#CategoryId").select2();
        });
    </script>
}